/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;

/**
 * <p>Project: smvc2022 - IndexController
 * <p>Powered by webrx On 2022-03-28 11:42:06
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@RestController
public class IndexController {

    @RequestMapping
    public ModelAndView index(ModelAndView mv) {
        mv.setViewName("index");
        mv.addObject("name","张三丰");
        mv.addObject("addrs",new String[]{"郑州","开封","洛阳","新乡","许昌"});
        return mv;
    }

    @RequestMapping("t1")
    public ModelAndView t1(ModelAndView mv) {
        mv.setViewName("t1");
        mv.addObject("msg","<font color=red>html font中文字符效果</font>");
        mv.addObject("id",66);
        mv.addObject("name","张三丰");
        //mv.addObject("age",25);
        return mv;
    }

    @RequestMapping("t2")
    public ModelAndView t2(ModelAndView mv) {
        mv.setViewName("t2");
        mv.addObject("msg","<font color=red>html font中文字符效果</font>");
        mv.addObject("id",66);
        mv.addObject("name","张三丰");
        mv.addObject("localdate", LocalDate.now());
        mv.addObject("localtime", LocalTime.now());
        mv.addObject("localdatetime",LocalDateTime.now());
        mv.addObject("date",new Date());
        mv.addObject("num",102);
        mv.addObject("number",12.242392);
        //mv.addObject("age",25);
        return mv;
    }
}
